package cn.tradewin.advisor.commons.selectmodel;

import java.util.List;

import org.apache.tapestry5.OptionGroupModel;
import org.apache.tapestry5.OptionModel;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.util.AbstractSelectModel;

import cn.tradewin.advisor.persist.model.CodeLabel;

public class CodeLabelSelectModelT extends AbstractSelectModel {

private final List<CodeLabel> codeLabels;
	
	public CodeLabelSelectModelT(List<CodeLabel> codeLabels) {
		this.codeLabels = codeLabels;
	}
	
	@Override
	public List<OptionGroupModel> getOptionGroups() {
		return null;
	}

	@Override
	public List<OptionModel> getOptions() {
		List<OptionModel> options = CollectionFactory.newList();
		for (CodeLabel option : codeLabels) {
			options.add(new CodeLabelOptionModel(option));
		}
		return options;
	}
}
